Skip to main content
Glama
hyperspell

hyperspell-mcp

Official
by hyperspell

Get Collection

Retrieve all documents from a specified collection to access and manage your unstructured data through the Hyperspell MCP server.

Instructions

Get a list of all documents in a collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_nameYes

Implementation Reference

  • The handler function that executes the logic for the 'Get Collection' tool. It lists all documents in the specified collection using the Hyperspell API and converts them to Document objects.
    def get_documents(collection_name: str) -> list[Document]:
        """Get a list of all documents in a collection"""
        r = mcp.api.documents.list(collection=collection_name)
        return Document.from_pydantic(r.items)
  • Pydantic-compatible dataclass defining the schema for Document objects returned by the 'Get Collection' tool.
    class Document(BaseModel):
        id: int
        title: str
        type: str
        summary: str
  • Decorator that registers the get_documents handler as the 'Get Collection' tool (or resource) in the MCP server, based on configuration.
    @mcp.tool_or_resource("collection://{collection_name}", name="Get Collection")
  • Helper method used by Document.from_pydantic to convert API response models to the local dataclass format.
    @dataclass
    class BaseModel:
        @overload
        @classmethod
        def from_pydantic(cls, model: PydanticBaseModel) -> Self: ...
    
        @overload
        @classmethod
        def from_pydantic(cls, model: Sequence[PydanticBaseModel]) -> list[Self]: ...
    
        @classmethod
        def from_pydantic(
            cls, model: PydanticBaseModel | Sequence[PydanticBaseModel]
        ) -> Self | list[Self]:
            """Convert a Pydantic model to a data class, selecting only the keys that are part of the data class."""
            if isinstance(model, Sequence):
                return [cls.from_pydantic(m) for m in model]
    
            data = model.model_dump()
            # Only select the keys in data that are part of this data class
            data = {key: value for key, value in data.items() if key in cls.__annotations__}
            return cls(**data)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it 'Get[s] a list', implying a read-only operation, but doesn't mention permissions, rate limits, pagination, error handling, or what format the list returns. This leaves significant gaps for a tool that presumably accesses data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with zero wasted words. It's appropriately sized for a simple tool and front-loaded with the core action, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (1 parameter, no output schema, no annotations), the description is incomplete. It doesn't cover behavioral aspects like response format or error cases, and with low schema coverage, it fails to fully explain the parameter. For a data retrieval tool, this leaves the agent with insufficient context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter with 0% description coverage, so the description must compensate. It mentions 'collection_name' implicitly via 'collection', but doesn't explain what a collection is, valid values, or constraints. This adds minimal semantic value beyond the schema's basic structure.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('list of all documents in a collection'), making the purpose understandable. However, it doesn't explicitly distinguish this tool from its sibling 'Get Document', which likely retrieves a single document rather than all documents in a collection.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'Get Document' or 'List Collections'. It mentions 'all documents in a collection', but doesn't clarify prerequisites, exclusions, or specific contexts for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hyperspell/hyperspell-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server